package com.album.activity.page;


import android.app.Activity;
import android.content.Context;
import android.os.Message;
import android.view.MotionEvent;
import android.view.View;


public abstract class Page{
	
	protected PageManager manager;
	
 	public Page(PageManager manager) {
		this.manager = manager;
	}
	
 	public abstract View getView();
	
 	public void onCreate(Object extra){
 		
 	}
	
 	public void onActive(Object extra){
 		
 	}
	
 	public  void onPause(){
 		
 	}
	
 	public void onDestroy(){
 		
 	}
 	
 	/**
 	 * this method will be call by UI Thread (main thread)
 	 */
 	public void handleMessage(Message msg){
 		
 	}
	
 	/**
 	 * handle keyBack event, if you don't want 
 	 * system handle it, return true
 	 */
	public boolean onKeyDown(){
		return false;
	}
	
	public PageManager getManager() {
		return manager;
	}
	
	/**
	 * @return Context
	 */
	public Context getContext() {
		return manager.getContext();
	}
	
	public boolean isCanBack(){
		return true;
	}
	
	/**
	 * if you don't want show menu bar, return false.
	 * @return
	 */
	public boolean isShowMenuBar(){
		return true;
	}
	
	/**
	 * handle touch event, if you don't want event go on, 
	 * return true, then the event will stop.
	 * @param event
	 * @return
	 */
	public boolean onTouchEvent(MotionEvent event) {
		return false;
	}
}
